package com.we.scrm.wechat.common.util;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import com.we.scrm.wechat.common.AccessToken;

public class WechatCacheUtil {
    //小程序token
    static final String MAPP_ACCESS_TOKEN_KEY = "_mapp_access_token_";
    //小程序openid对应的session key
    static final String OPENID_SESSION_KEY = "_openid_session_key_";
    //模拟一个内存缓存，存储token
    private static Map<String, Object> cache = new ConcurrentHashMap<String, Object>();

    //模拟一个内存缓存，存储openid对应的sessionkey
    private static Map<String, String> sessionCache = new ConcurrentHashMap<String, String>();






    //微信小程序缓存session_key
    public static String getSessionKey(String openid) {
        String cacheKey = openid + OPENID_SESSION_KEY;
        return sessionCache.get(cacheKey);
    }

    public static void setSessionKey(String openid, String sessionKey) {
        String cacheKey = openid + OPENID_SESSION_KEY;
        sessionCache.put(cacheKey, sessionKey);
    }



}
